home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 126-150 / disk_133 / overscan / overscan_lib.asm < prev    next >
Assembly Source File  |  1992-05-06  |  6KB  |  200 lines

  1. ;(overscan_lib.asm)
  2.  
  3. ;    overscan
  4. ;   ----------
  5.  
  6. ;   By Ari Freund - 20/11/87
  7.  
  8. ; Patches up the Intuition library so that sizable windows with MaxHeight = 200
  9. ; (or 400 in lace), and screens with Height = 200 (or 400 in lace) will take
  10. ; advantage of the PAL overscan capability of Intuition V1.2.
  11.  
  12. ; To install the patch type: overscan
  13. ; To remove it type:         overscan delete
  14.  
  15. ; Compile and assemble using Aztec C V3.40a:cc overscan.c +C +D
  16. ;                                           as overscan_lib.asm
  17. ; Create a library file using the librarian:lb overscan.lib overscan_lib.o
  18. ; Link using Aztec C V3.40a:                ln +S overscan.o overscan.lib c.lib
  19.  
  20. ; You may also execute the overscan.make file.
  21.  
  22. ; This part contains the patch itself and should be linked to 'overscan.o'
  23. ; which installes and deletes it.
  24.  
  25. ; See overscan.doc for more information.
  26. ;-------------------------------------------------------------------------------
  27.  
  28.         far    code
  29.         far    data
  30.  
  31.         nolist
  32.         include    "intuition/intuition.i"
  33.         list
  34.  
  35. ib_Preferences    equ    868        ;pointer to Preferences in Intuition.lib
  36.  
  37. addq.l_1    equ    $52b9        ;opcode for: "addq.l   #1,in_use"
  38. subq.l_1    equ    $53b9        ;opcode for: "subq.l   #1,in_use"
  39.  
  40. INC_IN_USE    macro            ;  addq.l   #1,in_use
  41.         dc.w    addq.l_1    ;Flag patch as in use.
  42.         dc.l    in_use
  43.         endm
  44.  
  45. DEC_IN_USE    macro            ;  subq.l   #1,in_use
  46.         dc.w    subq.l_1    ;Flag patch as not in use.
  47.         dc.l    in_use
  48.         endm
  49.  
  50. ; Data items are placed in the code segment in order for the entire patch
  51. ; to be contained within a single segment.
  52.  
  53.         cseg
  54.  
  55. ; ATTENTION!!
  56. ; The following data items MUST appear in the following precise order!
  57.  
  58. ; The following chunk of variables is identified by the external symbol
  59. ; '_data' so C programs can refer to them as members in the 'data' struct.
  60.  
  61. _data:
  62.  
  63. ;Initialize the Node substructure in the message port.
  64. port        ds.l    2        ; ln_Succ and ln_Pred
  65.         dc.b    NT_MSGPORT    ; ln_Type
  66.         dc.b    0        ; ln_Pri
  67.         dc.l    _myname        ; ln_Name
  68. ;Allocate the rest of the port.
  69.         ds.b    MP_SIZE-LN_SIZE
  70.         cnop    0,2
  71. myseg        ds.l    1        ;pointer to this segment
  72. oldscreen_adr    ds.l    1        ;pointer to Intuition's OpenScreen()
  73. oldwindow_adr    ds.l    1        ;pointer to Intuition's OpenWindow()
  74. in_use        dc.l    0        ;flag indicating patch is/isn't in use
  75. _IntuitionBase    ds.l    1        ;pointer to Intuition
  76. _myname        dc.b    "Ari's: overscan message port",0
  77.  
  78.         public    _data,_IntuitionBase,_myname
  79.         public    in_use
  80.  
  81. ; O.K., here come the routines themselves.
  82.  
  83. ;   This routine is called from Intuition's (patched) vector table
  84. ;   each time somebody calls OpenScreen().
  85.  
  86. ;     if
  87. ;        not a custom bitmap
  88. ;        and height is the maximum for the American standard (lace/no lace)
  89. ;     then set height to the maximum for this Amiga.
  90.  
  91.     cnop    0,2                ;allign to word boundry
  92.  
  93.     public    _screenpatch
  94. _screenpatch:
  95.  
  96.     INC_IN_USE
  97.  
  98.     move.w    ns_Height(a0),-(sp)        ;Save height.
  99.     move.l    a0,-(sp)            ;Save pointer to NewScreen.
  100.  
  101.     move.w    ns_Type(a0),d0            ;Is it a custombitmap screen?
  102.     andi.w    #CUSTOMBITMAP,d0    
  103.     bne    openscreen            ;Yes - open it with no change.
  104.  
  105.     move.w    #200,d0             ;Maxheight is 200.
  106.     move.w    ns_ViewModes(a0),d1        ;If in lace double it to 400.
  107.     andi.w    #V_LACE,d1
  108.     beq    dotest
  109.     asl.w    #1,d0
  110. dotest:
  111.     cmp.w    ns_Height(a0),d0        ;Does Height=maxheight?
  112.     bne    openscreen            ;No - open screen with no change
  113.     move.w    #STDSCREENHEIGHT,ns_Height(a0)    ;Set to maxheight for this Amiga
  114.  
  115. openscreen:
  116.     move.l    oldscreen_adr,a1        ;Call Intuition to open screen.
  117.     jsr    (a1)
  118.  
  119.     move.l    (sp)+,a0            ;Restore height.
  120.     move.w    (sp)+,ns_Height(a0)
  121.  
  122.     DEC_IN_USE
  123.  
  124.     rts
  125.  
  126.  
  127. ;   This routine is called from Intuition's (patched) vector table
  128. ;   each time somebody calls OpenWindow().
  129.  
  130. ;     if
  131. ;        not a super bitmap
  132. ;        and windowsizing gadget is attached
  133. ;        and
  134. ;            either
  135. ;                   screen is a custom screen
  136. ;                   and screen is big enough
  137. ;                   and max height for the window is the American standard max
  138. ;             or
  139. ;                   screen is wb
  140. ;                   and max height for the window is the American standard max
  141. ;     then set max height to the maximum for this Amiga.
  142.  
  143.     public    _windowpatch
  144. _windowpatch:
  145.  
  146.     INC_IN_USE
  147.  
  148.     move.w    nw_MaxHeight(a0),-(sp)        ;Save max height.
  149.     move.l    a0,-(sp)            ;Save pointer to NewWindow.
  150.  
  151.     move.l    nw_Flags(a0),d0            ;Is it a super bitmap window?
  152.     andi.l    #SUPER_BITMAP,d0
  153.     bne    openwindow            ;Yes - open it with no change.
  154.  
  155.     move.l    nw_Flags(a0),d0            ;Is a sizing gadget attached?
  156.     andi.l    #WINDOWSIZING,d0
  157.     beq    openwindow            ;No - open window with no change
  158.  
  159.     move.w    #200,d0                ;Maxheight is 200.
  160.     cmpi.w    #CUSTOMSCREEN,nw_Type(a0)    ;Is it in a custom screen?
  161.     bne    checkwb                ;No - go check for WB screen.
  162.  
  163.     move.l    nw_Screen(a0),a1
  164.     cmpi.w    #256,sc_Height(a1)        ;Is screen big enough?
  165.     bne    openwindow            ;No - open window with no change
  166.  
  167.     move.w    sc_ViewPort+vp_Modes(a1),d1    ;If in lace...
  168.     andi.w    #V_LACE,d1            ;...double maxheight to 400.
  169.     beq    dotest1
  170.     asl.w    #1,d0
  171. dotest1:
  172.     cmp.w    nw_MaxHeight(a0),d0        ;Does MaxHeight=maxheight?
  173.     bne    openwindow            ;No - open window with no change
  174.  
  175.     move.w    #STDSCREENHEIGHT,nw_MaxHeight(a0)
  176.  
  177. openwindow:
  178.     move.l    oldwindow_adr,a1        ;Call Intuition to open window.
  179.     jsr    (a1)
  180.  
  181.     move.l    (sp)+,a0            ;Restore MaxHeight.
  182.     move.w    (sp)+,nw_MaxHeight(a0)
  183.  
  184.     DEC_IN_USE
  185.  
  186.     rts
  187.  
  188. checkwb:
  189.     cmpi.w    #WBENCHSCREEN,nw_Type(a0)    ;Is it the wb screen?
  190.     bne    openwindow            ;Unknown type - don't change.
  191.  
  192.     move.l    _IntuitionBase,a1
  193.     move.l    ib_Preferences(a1),a1
  194.     cmpi.b    #LACEWB,pf_LaceWB(a1)        ;If in lace double max height...
  195.     bne    dotest1                ;...to 400.
  196.     asl.w    #1,d0
  197.     bra    dotest1                ;Go do the change if needed.
  198.  
  199.     end
  200.